import request from '@/utils/request'

/**
 * 获取年级列表
 * @param {Object} data: { page: 页码, pagesize: 每页条数 }
 * @return Promise
 */
export const getGradeListAPI = (params) => {
  return request({
    url: '/grade/',
    params
  })
}

/**
 * 添加年级
 * @param {Object} data: { name: 名称, description: 描述 }
 * @return Promise
 */
export const addGradeAPI = (data) => {
  return request({
    url: '/grade/',
    method: 'POST',
    data
  })
}

/**
 * 修改年级信息
 * @param {Object} data: { name: 名称, description: 描述 }
 * @return Promise
 */
export const updateGradeAPI = (data) => {
  return request({
    url: '/grade/',
    method: 'PATCH',
    data
  })
}

/**
 * 删除年级
 * @param id
 * @return Promise
 */
export const deleteGradeAPI = (id) => {
  return request({
    url: `/grade/${id}`,
    method: 'DELETE'
  })
}
